package com.ggh.jinjilive.ui.mine.setting;

import android.os.Bundle;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.blankj.utilcode.util.BarUtils;
import com.ggh.jinjilive.R;
import com.ggh.jinjilive.databinding.ActivityTextBinding;
import com.ggh.jinjilive.listener.AddOnClickListener1;
import com.ggh.jinjilive.mobile.CommonMobile;
import com.ggh.jinjilive.ui.BaseActivity;
import com.ggh.jinjilive.utils.ARouterUtils;
import com.ggh.jinjilive.utils.GeneralUtils;
import com.gyf.immersionbar.ImmersionBar;
import com.zzhoujay.richtext.RichText;

@Route(path = ARouterUtils.TextActivity)
public class TextActivity extends BaseActivity<ActivityTextBinding> {

    private String title;

    @Override
    public void initCreate() {
        super.initCreate();
        ImmersionBar.with(this).keyboardEnable(true).init();
    }

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_text;
    }

    @Override
    public void initParam() {
        super.initParam();
        title = getIntent().getStringExtra("title");
    }

    @Override
    public void initView() {
        super.initView();
        setWhiteActionBarStyle(title,true,true);
        //获取状态栏高度
        binding.llSpacing.setPadding(0, BarUtils.getStatusBarHeight(),0,0);
    }

    @Override
    public void initData() {
        super.initData();
        if(title.equals("社区公约")){
            GeneralUtils.agreementCommunity(new AddOnClickListener1() {
                @Override
                public void onSkipClicked(Object mObject) {
                    CommonMobile commonMobile = (CommonMobile) mObject;
                    if(null != commonMobile){
                        RichText.from(commonMobile.getInfo()).into(binding.tvContent);
                    }
                }
            });
        }else if(title.equals("隐私政策")){
            GeneralUtils.agreementPrivacy(new AddOnClickListener1() {
                @Override
                public void onSkipClicked(Object mObject) {
                    CommonMobile commonMobile = (CommonMobile) mObject;
                    if(null != commonMobile){
                        RichText.from(commonMobile.getInfo()).into(binding.tvContent);
                    }
                }
            });
        }else if(title.equals("服务条例")){
            GeneralUtils.agreementService(new AddOnClickListener1() {
                @Override
                public void onSkipClicked(Object mObject) {
                    CommonMobile commonMobile = (CommonMobile) mObject;
                    if(null != commonMobile){
                        RichText.from(commonMobile.getInfo()).into(binding.tvContent);
                    }
                }
            });
        }else if(title.equals("联系我们")){
            GeneralUtils.agreementContactus(new AddOnClickListener1() {
                @Override
                public void onSkipClicked(Object mObject) {
                    CommonMobile commonMobile = (CommonMobile) mObject;
                    if(null != commonMobile){
                        RichText.from(commonMobile.getInfo()).into(binding.tvContent);
                    }
                }
            });
        }else if(title.equals("主播协议")){
            GeneralUtils.agreementAnchor(new AddOnClickListener1() {
                @Override
                public void onSkipClicked(Object mObject) {
                    CommonMobile commonMobile = (CommonMobile) mObject;
                    if(null != commonMobile){
                        RichText.from(commonMobile.getInfo()).into(binding.tvContent);
                    }
                }
            });
        }else if(title.equals("法律法规")){
            GeneralUtils.agreementLaw(new AddOnClickListener1() {
                @Override
                public void onSkipClicked(Object mObject) {
                    CommonMobile commonMobile = (CommonMobile) mObject;
                    if(null != commonMobile){
                        RichText.from(commonMobile.getInfo()).into(binding.tvContent);
                    }
                }
            });
        }else if(title.equals("市场规范")){
            GeneralUtils.agreementMarket(new AddOnClickListener1() {
                @Override
                public void onSkipClicked(Object mObject) {
                    CommonMobile commonMobile = (CommonMobile) mObject;
                    if(null != commonMobile){
                        RichText.from(commonMobile.getInfo()).into(binding.tvContent);
                    }
                }
            });
        }else if(title.equals("开店入驻协议")){
            GeneralUtils.agreementShop(new AddOnClickListener1() {
                @Override
                public void onSkipClicked(Object mObject) {
                    CommonMobile commonMobile = (CommonMobile) mObject;
                    if(null != commonMobile){
                        RichText.from(commonMobile.getInfo()).into(binding.tvContent);
                    }
                }
            });
        }
    }

    @Override
    public void initViewObservable() {
        super.initViewObservable();

    }
}
